home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK2.toast / Development Kits (Disc 2) / ScriptX / Code Samples / untested / tcpip / browser / embed.sx < prev    next >
Encoding:
Text File  |  1996-05-21  |  1.0 KB  |  44 lines  |  [TEXT/ttxt]

  1. ---<<<
  2.  
  3. module EmbeddedBouncingBall
  4. uses ScriptX, WebBrowserInterface
  5. exports bounceApplet, startEmbeddedTitle
  6. end
  7.  
  8. in module EmbeddedBouncingBall
  9.  
  10. class bounceApplet (WebApplet)
  11. instance variables
  12.     mySpace
  13. end
  14.  
  15. class ball (TwoDShape, Projectile)
  16. end
  17.  
  18. method init self {object bounceApplet} #rest args #key parent: -> (
  19.     apply nextmethod self args
  20.     self.mySpace := new TwoDSpace boundary: (copy parent.bbox) stroke: blackbrush
  21.     append parent self.mySpace
  22.     local ballcolor := new brush color:(new rgbcolor red:0 green:200 blue:0) \
  23.             pattern:blackPattern
  24.     local shp := new ball target:(new oval x1:0 y1:0 x2:20 y2:20)  \
  25.             fill:ballcolor stroke:undefined
  26.     shp's x := 50;
  27.     shp's y := 50;
  28.     shp's elasticity := 1
  29.     append self.mySpace shp
  30.     shp's velocity := (new point x:-8.0 y:4.0)
  31.  
  32.     local g := new gravity space: self.mySpace
  33.     local m := new movement space: self.mySpace
  34.     local b := new bounce space: self.mySpace
  35.  
  36.     append b shp
  37.     append m shp
  38.     -- append g shp
  39. )
  40.  
  41. function startEmbeddedTitle tc -> foreach tc load undefined
  42.  
  43. --->>>
  44.